#include"Poller.h"
#include"EPollPoller.h"
#include"Channel.h"
namespace wjc {
    Poller::Poller(Core* core)
        : ownerCore_(core)
    {
    }

    Poller::~Poller() = default;

    Poller* Poller::newDefaultPoller(Core* core)
    {
        return new EPollPoller(core);
    }

    void Poller::assertInLoopThread() const
    {
        assert(ownerCore_->isInCoreThread());
    }

    bool Poller::hasChannel(Channel * channel) const
    {
        //assertInLoopThread();
        ChannelMap::const_iterator it = channels_.find(channel->fd());
        return it != channels_.end() && it->second == channel;
    }
}